<template>
  <div class="about_user">
    <div class="card">
      <Card dis-hover>
        <p slot="title" class="title">个人成就</p>
        <div class="achievement_box">
          <div class="likes_count_box">
            <div class="icon_box">
              <i class="iconfont icon-liulan"></i>
            </div>
            <div class="count_box">
              获得点赞
              <span class="num">{{otherInfo.likeCount}}</span>
            </div>
          </div>
          <div class="views_count_box">
            <div class="icon_box">
              <i class="iconfont icon-like-active-"></i>
            </div>
            <div class="count_box">
              文章被阅读
              <span class="num">{{otherInfo.viewCount}}</span>
            </div>
          </div>
        </div>
      </Card>
    </div>
    <div class="card">
      <Card dis-hover>
        <div class="follow_box">
          <div class="follow_item">
            <div class="title">关注了</div>
            <div class="num">{{userFollow.followerNum}}</div>
          </div>
          <div class="follow_item">
            <div class="title">关注者</div>
            <div class="num">{{userFollow.followeeNum}}</div>
          </div>
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      userFollow: {},
      otherInfo: {},
     
      peopleid: this.$route.params.uid
    };
  },
  props: {
    userfollow: {
      type: Object
    },
   
  },
  watch: {
    userfollow(val) {
      this.userFollow = val;
    },
   
    $route: function(newVal, oldVal) {
      this.peopleid = newVal.params.uid;
    },
    peopleid(val) {
      this.$set(this, "otherInfo", {});
      this.getUserOtherInfo(val);
    }
  },
  methods: {
    getUserOtherInfo(peopleid) {
      this.$axios
        .get("/get_multi_user", {
          params: {
            uid: peopleid
          }
        })
        .then(res => {
          this.otherInfo = res.data.data;
        })
        .catch(err => {
          console.log(err.response);
        });
    }
  },
  mounted() {
    this.getUserOtherInfo(this.peopleid);
  }
};
</script>

<style lang='scss'>
.about_user {
  position: fixed;
  width: 240px;
  .card {
    margin-bottom: 1rem;
    .title {
      font-size: 1.2rem;
      // color: #000;
      font-weight: 700;
    }
    .achievement_box {
      display: flex;
      flex-direction: column;
      .likes_count_box {
        display: flex;
        flex-direction: row;
        align-items: center;
      }
      .views_count_box {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-top: 0.5rem;
      }
      .icon_box {
        height: 1.5rem;
        width: 1.5rem;
        margin-right: 0.5rem;
        border-radius: 50%;
        background-color: rgb(225, 239, 255);
        .iconfont {
          font-size: 15px;
          color: rgb(123, 185, 255);
          display: flex;
          align-items: center;
          justify-content: center;
          height: 100%;
          line-height: 1;
        }
      }
      .count_box {
        .num {
          margin-left: 0.5rem;
        }
      }
    }
    .follow_box {
      display: flex;
      flex-direction: row;
      justify-content: center;
      .follow_item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        .title {
          font-size: 1rem;
          font-weight: 500;
        }
        .num {
          font-size: 1.05rem;
          font-weight: 700;
        }
      }
    }
  }
}
</style>